﻿var Unicode = {
    enUnicode: function (str) {
        var a = [],
        i = 0;
        for (; i < str.length;) a[i] = str.charCodeAt(i++);
        return "&#" + a.join(";&#") + ";"
    },
    deUnicode: function (str) {
        return str.replace(/&#(x)?([^&]{1,5});?/g,
        function (a, b, c) {
            return String.fromCharCode(parseInt(c, b ? 16 : 10))
        })
    }
};